Lua/Client/ClientEffect/Static Functions/Create
From JC2-MP Documentation
< Lua | Client | ClientEffect
Returns | ClientEffect |
---|---|
Prototype | ClientEffect.Create(AssetLocation, table arguments) |
Description | No description |
Argument table
Required values
Type
Name
Notes
Vector3
position
Angle
angle
number
effect_id
From 0 to 467. Use this effects browser to find effect ids.
Examples
Create an explosion where you click
effects = {}
Events:Subscribe("MouseDown", function(args)
if args.button ~= 1 then
return
end
local result = Physics:Raycast(
Camera:GetPosition(),
Camera:GetAngle() * Vector3.Forward,
0,
100
)
local spawnArgs = {
position = result.position + result.normal * 0.25,
angle = Angle(),
effect_id = 35,
}
local effect = ClientEffect.Create(AssetLocation.Game, spawnArgs)
table.insert(effects, effect)
end)
-- Make sure to clean up everything on ModuleUnload.
Events:Subscribe("ModuleUnload", function()
for index, effect in ipairs(effects) do
effect:Remove()
end
end)